//
// Created by LiuYou on 2021/5/7.
//

#include <fcntl.h>
#include "ClientData.hpp"

int C::setNonBlocking(int fd) {
    int oldOption = fcntl(fd, F_GETFL);
    int newOption = oldOption | O_NONBLOCK;
    fcntl(fd, F_SETFL, newOption);
    return oldOption;
}

const sockaddr_in& C::ClientData::getSockAddrIn() const {
    return sockAddrIn;
}

void C::ClientData::setSockAddrIn(const sockaddr_in& sockAddrIn) {
    ClientData::sockAddrIn = sockAddrIn;
}

char* C::ClientData::getWriteBuffer() const {
    return writeBuffer;
}

void C::ClientData::setWriteBuffer(char* writeBuffer) {
    ClientData::writeBuffer = writeBuffer;
}

const char* C::ClientData::getBuffer() const {
    return buffer;
}

char* C::ClientData::getBuffer() {
    return buffer;
}
